package com.zbkj.service.model.front.vo.order;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.time.LocalDate;
import java.time.LocalDateTime;

@Data
@ApiModel
public class OrderStatusDetailVo {

    @ApiModelProperty(value = "状态", example = "1")
    private String status;

    @ApiModelProperty(value = "未支付")
    private UnPay unPay;

    @ApiModelProperty(value = "待自提")
    private PickUp pickUp;

    @ApiModelProperty(value = "已发货运输中")
    private DeliveryInfo inTransit;

    @ApiModelProperty(value = "已送达待确认收获")
    private DeliveryInfo waitConfirm;

    @ApiModelProperty(value = "已确认收获")
    private AlreadyConfirm alreadyConfirm;

    @ApiModelProperty(value = "待归还")
    private WaitReturn waitReturn;

    @ApiModelProperty(value = "归还待取件")
    private ReturnWaitPickUp returnWaitPickUp;

    @ApiModelProperty(value = "归还已送出")
    private AlreadySendOut alreadySendOut;

    @ApiModelProperty(value = "已预约到店归还")
    private ReserveArriveStore reserveArriveStore;

    @ApiModelProperty(value = "归还已收货")
    private ReturnAndReceiving returnAndReceiving;

    @ApiModelProperty(value = "归还完成")
    private ReturnFinish returnFinish;

    @ApiModelProperty(value = "购买订单已完成")
    private BuyOrderFinish BuyOrderFinish;

    @ApiModelProperty(value = "已延长承亭订单完成")
    private LeaseLengthen leaseLengthen;

    @ApiModelProperty(value = "已取消")
    private Void alreadyCancel;

    @ApiModelProperty(value = "承享超时")
    private LeaseTimeout leaseTimeout;

    @ApiModelProperty(value = "买断")
    private Buyout buyout;

    @Data
    @ApiModel
    public static class Buyout {

        @ApiModelProperty(value = "送货信息")
        private LogisticsInfo logisticsInfo;

    }

    @Data
    @ApiModel
    public static class LeaseTimeout {
        @ApiModelProperty(value = "最后归还时间", example = "2023-11-30 23:59:59")
        private LocalDateTime lastReturnTime;


        @ApiModelProperty(value = "每天扣除金额", example = "230.00")
        private String deductDaily;

        @ApiModelProperty(value = "买断时间", example = "2023-11-31 00:00:00")
        private LocalDateTime buyoutTime;

        @ApiModelProperty(value = "送货信息")
        private LogisticsInfo logisticsInfo;
    }

    @Data
    @ApiModel
    public static class LeaseLengthen {

        @ApiModelProperty(value = "送货信息")
        private LogisticsInfo logisticsInfo;

    }


    @Data
    @ApiModel
    public static class BuyOrderFinish {

        @ApiModelProperty(value = "送货信息")
        private LogisticsInfo logisticsInfo;

    }

    @Data
    @ApiModel
    public static class ReturnFinish {

        @ApiModelProperty(value = "归还物流信息")
        private LogisticsInfo returnLogisticsInfo;

        @ApiModelProperty(value = "租赁物流信息")
        private LogisticsInfo deliveryLogisticsInfo;

    }

    @Data
    @ApiModel
    public static class ReturnAndReceiving {
        @ApiModelProperty(value = "收货时间", example = "2023-11-31 00:00:00")
        private LocalDateTime receivingTime;

        @ApiModelProperty(value = "归还物流信息")
        private LogisticsInfo returnLogisticsInfo;

        @ApiModelProperty(value = "租赁物流信息")
        private LogisticsInfo deliveryLogisticsInfo;
    }

    @Data
    @ApiModel
    public static class ReserveArriveStore {

        @ApiModelProperty(value = "开始时间", example = "14:00")
        private String startTime;

        @ApiModelProperty(value = "结束时间", example = "15:00")
        private String endTime;

        @ApiModelProperty(value = "店铺信息")
        private ShopInfo shopInfo;

    }

    @Data
    @ApiModel
    public static class WaitReturn {
        @ApiModelProperty(value = "最后归还时间", example = "2023-11-31 00:00:00")
        private LocalDateTime lastTime;

        @ApiModelProperty(value = "物流信息")
        private LogisticsInfo logisticsInfo;
    }

    @Data
    @ApiModel
    public static class AlreadySendOut {
        @ApiModelProperty(value = "归还送出时间", example = "2023-11-31 00:00:00")
        private LocalDateTime sendOutTime;

        @ApiModelProperty(value = "归还物流信息")
        private LogisticsInfo returnLogisticsInfo;

        @ApiModelProperty(value = "租赁物流信息")
        private LogisticsInfo deliveryLogisticsInfo;
    }

    @Data
    @ApiModel
    public static class ReturnWaitPickUp {
        @ApiModelProperty(value = "快递名称", example = "顺丰快递")
        private String deliveryName;

        @ApiModelProperty(value = "时间描述", example = "今天")
        private String dateDesc;

        @ApiModelProperty(value = "开始时间", example = "14:00")
        private String startTime;

        @ApiModelProperty(value = "结束时间", example = "15:00")
        private String endTime;

        @ApiModelProperty(value = "寄件码", example = "2342")
        private String deliveryCode;

        @ApiModelProperty(value = "寄件人名称", example = "张三")
        private String senderName;

        @ApiModelProperty(value = "寄件人电话", example = "1291281927732")
        private String senderPhone;

        @ApiModelProperty(value = "寄件人地址", example = "上海市闵行区芦恒路浦恒北苑")
        private String senderAddress;
    }

    @Data
    @ApiModel
    public static class AlreadyConfirm {
        @ApiModelProperty(value = "开始日期", example = "2023-12-11")
        private LocalDate startDate;

        @ApiModelProperty(value = "结束日期", example = "2023-12-24")
        private LocalDate endDate;

        @ApiModelProperty(value = "剩余天数", example = "8")
        private Integer remainingDays;

        @ApiModelProperty("物流信息")
        private LogisticsInfo logisticsInfo;
    }

    @Data
    @ApiModel
    public static class UnPay {

        @ApiModelProperty(value = "关单时间", example = "2023-11-31 00:00:00")
        private LocalDateTime closeTime;
    }

    @Data
    @ApiModel
    public static class PickUp {
        @ApiModelProperty(value = "店铺信息")
        private ShopInfo shopInfo;
    }

    @Data
    @ApiModel
    public static class DeliveryInfo {

        @ApiModelProperty(value = "快递时间", example = "2023-11-31 00:00:00")
        private LocalDateTime deliveryTime;

        @ApiModelProperty(value = "物流信息")
        private LogisticsInfo logisticsInfo;

    }

    @Data
    @ApiModel
    public static class LogisticsInfo {
        @ApiModelProperty(value = "快递名称", example = "顺丰快递")
        private String deliveryName;

        @ApiModelProperty(value = "运单号", example = "21323234123123123")
        private String deliveryNo;

        @ApiModelProperty(value = "节点状态", example = "FINISH")
        private String nodeStatus;

        @ApiModelProperty(value = "节点状态描述", example = "已签收")
        private String nodeStatusDesc;

        @ApiModelProperty(value = "节点时间", example = "2023-11-31 00:00:00")
        private LocalDateTime nodeTime;

        @ApiModelProperty(value = "节点详情", example = "****************")
        private String nodeItem;
    }

    @Data
    @ApiModel
    public static class ShopInfo {
        @ApiModelProperty(value = "店铺名称", example = "店铺名称")
        private String shopName;

        @ApiModelProperty(value = "联系电话", example = "178234901239")
        private String phone;

        @ApiModelProperty(value = "地址", example = "上海市闵行区芦恒路浦恒北苑")
        private String address;
    }


    public static OrderStatusDetailVo buyout() {
        OrderStatusDetailVo status = new OrderStatusDetailVo();
        status.setStatus("买断");
        OrderStatusDetailVo.Buyout buyout = new OrderStatusDetailVo.Buyout();
        buyout.setLogisticsInfo(logisticsInfo());
        status.setBuyout(buyout);
        return status;
    }

    public static OrderStatusDetailVo leaseTimeout() {
        OrderStatusDetailVo status = new OrderStatusDetailVo();
        status.setStatus("承享超时");
        OrderStatusDetailVo.LeaseTimeout leaseTimeout = new OrderStatusDetailVo.LeaseTimeout();
        leaseTimeout.setLastReturnTime(LocalDateTime.now());
        leaseTimeout.setDeductDaily("230.00");
        leaseTimeout.setBuyoutTime(LocalDateTime.now());
        leaseTimeout.setLogisticsInfo(logisticsInfo());
        status.setLeaseTimeout(leaseTimeout);
        return status;
    }

    public static OrderStatusDetailVo alreadyCancel() {
        OrderStatusDetailVo status = new OrderStatusDetailVo();
        status.setStatus("已取消");
        return status;
    }

    public static OrderStatusDetailVo leaseLengthen() {
        OrderStatusDetailVo status = new OrderStatusDetailVo();
        status.setStatus("已延长承亭订单完成");
        OrderStatusDetailVo.LeaseLengthen leaseLengthen = new OrderStatusDetailVo.LeaseLengthen();
        leaseLengthen.setLogisticsInfo(logisticsInfo());
        status.setLeaseLengthen(leaseLengthen);
        return status;
    }

    public static OrderStatusDetailVo BuyOrderFinish() {
        OrderStatusDetailVo status = new OrderStatusDetailVo();
        status.setStatus("购买订单已完成");
        OrderStatusDetailVo.BuyOrderFinish buyOrderFinish = new OrderStatusDetailVo.BuyOrderFinish();
        buyOrderFinish.setLogisticsInfo(logisticsInfo());
        status.setBuyOrderFinish(buyOrderFinish);
        return status;
    }

    public static OrderStatusDetailVo returnFinish() {
        OrderStatusDetailVo status = new OrderStatusDetailVo();
        status.setStatus("归还完成");
        OrderStatusDetailVo.ReturnFinish returnFinish = new OrderStatusDetailVo.ReturnFinish();
        returnFinish.setReturnLogisticsInfo(logisticsInfo());
        returnFinish.setDeliveryLogisticsInfo(logisticsInfo());
        status.setReturnFinish(returnFinish);
        return status;
    }

    public static OrderStatusDetailVo returnAndReceiving() {
        OrderStatusDetailVo status = new OrderStatusDetailVo();
        status.setStatus("归还已收货");
        OrderStatusDetailVo.ReturnAndReceiving returnAndReceiving = new OrderStatusDetailVo.ReturnAndReceiving();
        returnAndReceiving.setReceivingTime(LocalDateTime.now());
        returnAndReceiving.setReturnLogisticsInfo(logisticsInfo());
        returnAndReceiving.setDeliveryLogisticsInfo(logisticsInfo());
        status.setReturnAndReceiving(returnAndReceiving);
        return status;
    }

    public static OrderStatusDetailVo reserveArriveStore() {
        OrderStatusDetailVo status = new OrderStatusDetailVo();
        status.setStatus("已预约到店归还");
        OrderStatusDetailVo.ReserveArriveStore reserveArriveStore = new OrderStatusDetailVo.ReserveArriveStore();
        reserveArriveStore.setStartTime("14:00");
        reserveArriveStore.setEndTime("15:00");
        reserveArriveStore.setShopInfo(shopInfo());
        status.setReserveArriveStore(reserveArriveStore);
        return status;
    }

    public static OrderStatusDetailVo alreadySendOut() {
        OrderStatusDetailVo status = new OrderStatusDetailVo();
        status.setStatus("归还已送出");
        OrderStatusDetailVo.AlreadySendOut alreadySendOut = new OrderStatusDetailVo.AlreadySendOut();
        alreadySendOut.setSendOutTime(LocalDateTime.now());
        alreadySendOut.setReturnLogisticsInfo(logisticsInfo());
        alreadySendOut.setDeliveryLogisticsInfo(logisticsInfo());
        status.setAlreadySendOut(alreadySendOut);
        return status;
    }

    public static OrderStatusDetailVo returnWaitPickUp() {
        OrderStatusDetailVo status = new OrderStatusDetailVo();
        status.setStatus("归还待取件");
        OrderStatusDetailVo.ReturnWaitPickUp returnWaitPickUp = new OrderStatusDetailVo.ReturnWaitPickUp();
        returnWaitPickUp.setDeliveryName("顺丰快递");
        returnWaitPickUp.setDateDesc("今天");
        returnWaitPickUp.setStartTime("14:00");
        returnWaitPickUp.setEndTime("15:00");
        returnWaitPickUp.setDeliveryCode("3882");
        returnWaitPickUp.setSenderName("张三");
        returnWaitPickUp.setSenderPhone("19273299382");
        returnWaitPickUp.setSenderAddress("上海市闵行区芦恒路浦恒北苑");
        status.setReturnWaitPickUp(returnWaitPickUp);
        return status;
    }

    public static OrderStatusDetailVo waitReturn() {
        OrderStatusDetailVo status = new OrderStatusDetailVo();
        status.setStatus("待归还");
        OrderStatusDetailVo.WaitReturn waitReturn = new OrderStatusDetailVo.WaitReturn();
        waitReturn.setLastTime(LocalDateTime.now().plusDays(1));
        waitReturn.setLogisticsInfo(logisticsInfo());
        status.setWaitReturn(waitReturn);
        return status;
    }

    public static OrderStatusDetailVo alreadyConfirm() {
        OrderStatusDetailVo status = new OrderStatusDetailVo();
        status.setStatus("已确认收获");
        OrderStatusDetailVo.AlreadyConfirm alreadyConfirm = new OrderStatusDetailVo.AlreadyConfirm();
        alreadyConfirm.setStartDate(LocalDate.now().minusDays(10));
        alreadyConfirm.setEndDate(LocalDate.now());
        alreadyConfirm.setRemainingDays(3);
        alreadyConfirm.setLogisticsInfo(logisticsInfo());
        status.setAlreadyConfirm(alreadyConfirm);
        return status;
    }

    public static OrderStatusDetailVo waitConfirm() {
        OrderStatusDetailVo status = new OrderStatusDetailVo();
        status.setStatus("已送达待确认收获");
        OrderStatusDetailVo.DeliveryInfo deliveryInfo = new OrderStatusDetailVo.DeliveryInfo();
        deliveryInfo.setDeliveryTime(LocalDateTime.now());
        deliveryInfo.setLogisticsInfo(logisticsInfo());
        status.setWaitConfirm(deliveryInfo);
        return status;
    }

    public static OrderStatusDetailVo inTransit() {
        OrderStatusDetailVo status = new OrderStatusDetailVo();
        status.setStatus("已发货运输中");
        OrderStatusDetailVo.DeliveryInfo deliveryInfo = new OrderStatusDetailVo.DeliveryInfo();
        deliveryInfo.setDeliveryTime(LocalDateTime.now());
        deliveryInfo.setLogisticsInfo(logisticsInfo());
        status.setInTransit(deliveryInfo);
        return status;
    }

    public static OrderStatusDetailVo pickUp() {
        OrderStatusDetailVo status = new OrderStatusDetailVo();
        status.setStatus("待自提");
        OrderStatusDetailVo.PickUp pickUp = new OrderStatusDetailVo.PickUp();
        pickUp.setShopInfo(shopInfo());
        status.setPickUp(pickUp);
        return status;
    }

    public static OrderStatusDetailVo unPay() {
        OrderStatusDetailVo status = new OrderStatusDetailVo();
        status.setStatus("待归还");
        OrderStatusDetailVo.UnPay unPay = new OrderStatusDetailVo.UnPay();
        unPay.setCloseTime(LocalDateTime.now());
        status.setUnPay(unPay);
        return status;
    }

    public static OrderStatusDetailVo.ShopInfo shopInfo() {
        OrderStatusDetailVo.ShopInfo shopInfo = new OrderStatusDetailVo.ShopInfo();
        shopInfo.setShopName("贝贝奢护管家-小贝（店名");
        shopInfo.setPhone("15268163617");
        shopInfo.setAddress("上海市普陀区祁山路111弄7号");
        return shopInfo;
    }

    public static OrderStatusDetailVo.LogisticsInfo logisticsInfo() {
        OrderStatusDetailVo.LogisticsInfo logisticsInfo = new OrderStatusDetailVo.LogisticsInfo();
        logisticsInfo.setDeliveryName("顺丰快递");
        logisticsInfo.setDeliveryNo("SF1028930383");
        logisticsInfo.setNodeStatus("FINISH");
        logisticsInfo.setNodeStatusDesc("已签收");
        logisticsInfo.setNodeTime(LocalDateTime.now());
        logisticsInfo.setNodeItem("您的包裹已送货上门。");
        return logisticsInfo;
    }
}
